package com.wu01.demo.controller;

import com.wu01.demo.Entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;
import java.util.List;

@Controller
public class TableController {

    @GetMapping("/simple")
    public String simple(Model model){
        User user1 = new User();
        User user2 = new User();
        User user3 = new User();
        User user4 = new User();
        user1.setUsername("112df");
        user2.setUsername("3434j2df");
        user3.setUsername("112dfdfjjdf");
        user4.setUsername("112sfdfdfdf");
        user1.setPassword("dfdfdf");
        user2.setPassword("11dfdfdf");
        user3.setPassword("d22fdfdf");
        user4.setPassword("df3434dfdf");
        List<User> users = Arrays.asList(user1, user2, user3, user4);
        model.addAttribute("users",users);
        return "table/simple";
    }
    @GetMapping("/jsgrid")
    public String jsgrid(){
        return "table/jsgrid";
    }
    @GetMapping("/data")
    public String data(){
        return "table/data";
    }

}
